package com.winit.generator.handler.impl;

import com.winit.generator.Constants;
import com.winit.generator.config.Configuration;
import com.winit.generator.handler.BaseHandler;
import com.winit.generator.model.DaoInfo;

import java.io.File;

public class ServiceNewHandler extends BaseHandler<DaoInfo> {

    public ServiceNewHandler(String ftlName, DaoInfo info){
        this.ftlName = ftlName;
        this.info = info;
        this.savePath = Configuration.getString("base.baseDir") + File.separator + Configuration.getString("service.path")
                        + File.separator + info.getClassNameNew() + "ServiceImpl" + Constants.FILE_SUFFIX_JAVA;

    }

    @Override
    public void combileParams(DaoInfo info) {
        this.param.put("corePackageStr", info.getCorePackageStr());
        this.param.put("servicePackageStr", info.getServicePackageStr());
        this.param.put("classNameNew", info.getClassNameNew());
        this.param.put("classNameNewLow", info.getClassNameNewLow());
        this.param.put("importStr", info.getImportStr());
        this.param.put("entityDesc", info.getEntityInfo().getEntityDesc());
        this.param.put("coreName", info.getCoreName());
        this.param.put("className", info.getClassName());
        this.param.put("classNameLow", info.getClassNameLow());
        this.param.put("entityClassName", info.getEntityInfo().getClassName());
        this.param.put("entityName", info.getEntityInfo().getEntityName());
        this.param.put("filterName", info.getEntityInfo().getFilterName());
        this.param.put("resultName", info.getEntityInfo().getResultName());
        this.param.put("filterPackageStr", info.getEntityInfo().getFilterPackage());
        this.param.put("entityPackageStr", info.getEntityInfo().getEntityPackage());
    }

}
